home *** CD-ROM | disk | FTP | other *** search
/ GameStar 2004 April / Gamestar_61_2004-04_dvdb.iso / DVDStar / Editace / hltp.exe / {app} / Source Code / MAP Viewer / Frustum.h < prev    next >
C/C++ Source or Header  |  2003-10-09  |  2KB  |  87 lines

  1. /*
  2. Half-Life MAP viewing utility.
  3. Copyright (C) 2003  Ryan Samuel Gregg
  4.  
  5. This program is free software; you can redistribute it and/or modify
  6. it under the terms of the GNU General Public License as published by
  7. the Free Software Foundation; either version 2 of the License, or
  8. (at your option) any later version.
  9.  
  10. This program is distributed in the hope that it will be useful,
  11. but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  13. GNU General Public License for more details.
  14.  
  15. You should have received a copy of the GNU General Public License
  16. along with this program; if not, write to the Free Software
  17. Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  18. */
  19.  
  20. #pragma once
  21.  
  22. __nogc class CFrustum
  23. {
  24. private:
  25.     float fAspect;
  26.  
  27.     float fWidth;
  28.     float fHeight;
  29.  
  30.     float mFrustum[6][4];
  31.  
  32.     int iCulled;
  33.  
  34. public:
  35.     CFrustum();
  36.  
  37.     inline void SetAspect(float fAspect)
  38.     {
  39.         this->fAspect = fAspect;
  40.     }
  41.  
  42.     inline void SetWidth(float fWidth)
  43.     {
  44.         this->fWidth = fWidth;
  45.     }
  46.  
  47.     inline void SetHeight(float fHeight)
  48.     {
  49.         this->fHeight = fHeight;
  50.     }
  51.  
  52.     inline float GetAspect()
  53.     {
  54.         return fAspect;
  55.     }
  56.  
  57.     inline float GetWidth()
  58.     {
  59.         return this->fWidth;
  60.     }
  61.  
  62.     inline float GetHeight()
  63.     {
  64.         return this->fHeight;
  65.     }
  66.  
  67.     inline void ResetCulled()
  68.     {
  69.         iCulled = 0;
  70.     }
  71.  
  72.     inline void IncCulled()
  73.     {
  74.         iCulled++;
  75.     }
  76.  
  77.     inline int GetCulled()
  78.     {
  79.         return iCulled;
  80.     }
  81.  
  82.     void CalculateFrustum();
  83.  
  84.     bool PointInFrustum(Vertex3f vPoint);
  85.     bool SphereInFrustum(BoundingSphere Sphere);
  86.     bool CubeInFrustum(BoundingBox Box);
  87. };